<?php
namespace app\admin\service;

use think\facade\Env;
use think\facade\App;

/**
 * 
 */
class RuntimeService {

    public static function getRootPath() {
        return App::getRootPath();
    }

    public static function isProd() {
        return Env::get('env', 'dev') == 'prod';
    }
    
    public static function wrapStaticUrl($url) {
        if(strstr('oss://', $url) === 0) {
            return $url;
        } else if(strstr('/static', $url) === 0) {
            $url = Env::get('host') .$url;
        } else if(str_contains($url, '/uploads') && $url[0] == '/') {
            $url = Env::get('host') .$url;
        }
        return $url;
    }
}
